import React from 'react';
import {Link} from 'react-router-dom';
import {Button} from 'antd';
import styles from './index.module.css';

const ErrorPage = (props) => {
    const {code,tips} = props;
    const navigate = useNavigate()
    return (
        <div className={styles.errorPage}>
            <div className={styles.errorCode}>
                {
                    code.split('').map((item,index) => {
                        return <span key={index}>{item}</span>;
                    })
                }
            </div>
            <div className={styles.errorDesc}>{tips}</div>
            <div className={styles.errorHandle}>
                <Link to="/main/dashboard" replace>
                    <Button type="primary" size="large">返回首页</Button>
                </Link>
                <Button className={styles.errorBtn} type="primary" size="large" onClick={() => {navigate(-1)}}>返回上一页</Button>
            </div>
        </div>
    )
}

export default ErrorPage;